package com.jxk.provider1.bean;

import com.jxk.common.entity.User;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class ConsumerService {
    @RabbitListener(queues = "demoQueue")
    public void recieved(String msg) {
        System.out.println("[demoQueue] recieved message: " + msg);
    }
    @RabbitListener(queues = "fanout.a")
    public void recieved2(String msg) {
        System.out.println("[fanout.a] recieved message: " + msg);
    }
    @RabbitListener(queues = "fanout.b")
    public void recieved3(String msg) {
        System.out.println("[fanout.b] recieved message: " + msg);
    }
    @RabbitListener(queues = "fanout.c")
    public void recieved4(String msg) {
        System.out.println("[fanout.c] recieved message: " + msg);
    }
    @RabbitListener(queues = "topic.a")
    public void recieved5(String msg) {
        System.out.println("[topic.a] recieved message:" + msg);
    }
    @RabbitListener(queues = "topic.b")
    public void recieved6(String msg) {
        System.out.println("[topic.b] recieved message:" + msg);
    }
    @RabbitListener(queues = "topic.c")
    public void recieved7(String msg) {
        System.out.println("[topic.c] recieved message:" + msg);
    }
    @RabbitListener(queues = "direct.a")
    public void receive(User user){
        System.out.println(user.toString());
    }
}
